package java0412;

import java.util.Scanner;

// 牛客:倒置字符串
//public class Main {
//    public static void main(String[] args) {
//        Scanner scanner = new Scanner(System.in);
//        while (scanner.hasNext()) {
//            String string = scanner.nextLine();
//            String ret = func(string);
//            System.out.println(ret);
//        }
//    }
//
//    private static String func(String string) {
//        String[] strings = string.split(" ");
//        String ret = "";
//        for (int i = strings.length - 1; i >= 1; i--) {
//            ret += strings[i] + " ";
//        }
//        ret += strings[0];
//        return ret;
//    }
//}


public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int N = scanner.nextInt();
            int[] nums = new int[N];
            for (int i = 0; i < N; i++) {
                nums[i] = scanner.nextInt();
            }
            int ret = func(nums);
            System.out.println(ret);
        }

    }

    private static int func(int[] nums) {
        if (nums.length == 1) {
            return 1;
        }
        int ret = 1;
        int i = 0;
        boolean preFlag = false;
        for (; i + 1 < nums.length; i++) {
            if (nums[i] == nums[i + 1]) {
                continue;
            }
            // 增为 true 减为 false
            preFlag = nums[i] > nums[i + 1] ? false : true;
            break;
        }
        boolean curFlag = false;
        for (; i + 1 < nums.length; i++) {
            if (nums[i] == nums[i + 1]) {
                continue;
            }
            curFlag = nums[i] > nums[i + 1] ? false : true;
            if (curFlag != preFlag) {
                ret++;
            }
            preFlag = curFlag;
        }
        return ret;
    }
}